package com.foton.bpc.all.remoting.netty;

import com.foton.bpc.all.remoting.Client;
import com.foton.bpc.all.remoting.Server;
import com.foton.bpc.all.remoting.Transport;
import com.foton.bpc.all.remoting.netty.adpect.HandlerAdpect;
import com.foton.bpc.all.remoting.netty.codec.Codec;

import java.net.URI;

/**
 * @Author RenPu
 * @Date 2023/6/5 16:45
 * @Version 1.0
 * @Description:
 **/
public class NettyServerTransport implements Transport {
    @Override
    public Server start(URI uri,Codec codec, HandlerAdpect handlerAdpect) {
        NettyServer nettyServer = new NettyServer();
        nettyServer.start(uri,codec,handlerAdpect);
        return nettyServer;
    }

    @Override
    public Client connect(URI uri, Codec codec, HandlerAdpect handlerAdpect) {
        NettyClient nettyClient = new NettyClient();
        nettyClient.connect(uri, codec, handlerAdpect);
        return nettyClient;
    }
}
